﻿
{include file="public/_meta" /}

<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 账户管理 <span class="c-gray en">&gt;</span> 账户列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form action="" method="get">
	<div class="text-c">
		<input type="text" class="input-text" style="width:250px" placeholder="输入用户名称或电话名称" id="" name="keywords">
		<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜账目</button>
	</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
		<a href="javascript:;" onclick="dataDel()" class="btn btn-danger  radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
		<a href="{:url('account/export_account_excel')}" class="btn btn-primary  radius">
			<i class="Hui-iconfont">&#xe644;</i> 导出excel
		</a>
	</span> <span class="r">共有数据：<strong>{$count}</strong> 条</span> </div>

	<div class="mt-20">
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr class="text-c">
				<th width="25"><input type="checkbox" name="" value=""></th>
				<th>ID</th>
				<th>姓名</th>
				<th>费用描述</th>
				<th>费用</th>
				<th>费用类型</th>
				<th>记录时间</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			{volist name="account" id="vo"}
			<tr class="text-c">
				<td><input class="checkbox" type="checkbox" value="{$vo.id}" name="id[]"></td>
				<td>{$vo.id}</td>
				<td><a href="javascript:void(0);" style="cursor:pointer" class="text-primary" onclick="student_show('{$vo.full_name}','{:url(\'student/student_show\')}?id={$vo.user_id}','{$vo.user_id}','500','450')"><u><b>{$vo.full_name}</b></u></a></td>
				<td>{$vo.cost_description}</td>
				<td>{$vo.cost}</td>
				<td>{$vo.cost_type}</td>
				<td>{$vo.record_time|date="Y-m-d H:i:s",###}</td>
				<td>{$vo.status}</td>
				<td class="td-manage"><a title="删除" href="javascript:;" onclick="del_account(this,'{$vo.id}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
			</tr>
			{/volist}
		</tbody>
	</table>
	</div>
</div>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer"/}
 <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">

	$(function(){
		$('.table-sort').dataTable({
			"aaSorting": [[ 1, "asc" ]],//默认第几个排序
			"bStateSave": true,//状态保存
			"aoColumnDefs": [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{"orderable":false,"aTargets":[0,8]}// 制定列不参与排序
			]
		});

	});
	
/*查看用户详情信息*/
function student_show(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*账单-删除*/
function del_account(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'post',
			url: "{:url('account/del_account')}",
			dataType: 'json',
			data: {id:id},
			success: function(rec){
				if(rec.status == true){
					layer.msg(rec.message,{icon:6,time:1000});
					setTimeout(jump,1000);
					function jump(){
						window.location.replace(location.href);
					}
				}else if(rec.status == false){
					layer.msg(rec.message,{icon:5,time:1000});
				}
			}
		});
	});
}
//批量删除
function dataDel(){
	layer.confirm('确认要删除吗？',function(index){
		var account_id =[];
		$('input[name="id[]"]:checked').each(function(){
			account_id.push($(this).val());
		});
		if(account_id.length==0){
			layer.msg('未选择删除项',{icon:5,time:1000});
		}else {
			$.ajax({
				type: 'post',
				url: "{:url('account/batch_del_account')}",
				dataType: 'json',
				data: {id:account_id},
				success: function(rec){
					if(rec.status == true){
						layer.msg(rec.message,{icon:6,time:1000});
						setTimeout(jump,1000);
						function jump(){
							window.location.replace(location.href);
						}
					}else if(rec.status == false){
						layer.msg(rec.message,{icon:5,time:1000});
					}else{
						layer.msg(rec.message,{icon:5,time:1000});
					}
				}
			});
		}
	});
}
</script> 
